using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;

namespace BrianLyttle.Samples.WinForms
{
    public partial class HeaderBase : UserControl
    {
        private string title;
        private string subtitle;
        private Icon glyph;

        public string Title
        {
            get { return title; }
            set { title = value; }
        }

        public string Subtitle
        {
            get { return subtitle; }
            set { subtitle = value; }
        }

        public Icon Glyph
        {
            get { return glyph; }
            set { glyph = value; }
        }


        public HeaderBase()
        {
            InitializeComponent();
        }

        protected override void OnPaint(PaintEventArgs pe)
        {
            using (Graphics gTitle = this.CreateGraphics())
            using (Font titleFont = new Font("Tahoma", 12, FontStyle.Bold))
            {
                gTitle.DrawString(title, titleFont, Brushes.Black, 20, 10);
            }

            using (Graphics gSubTitle = this.CreateGraphics())
            using (Font subTitleFont = new Font("Tahoma", 10, FontStyle.Regular))
            {
                gSubTitle.DrawString(subtitle, subTitleFont, Brushes.Black, 20, 35);
            }

            using (Graphics g = this.CreateGraphics())
            {
                if (glyph != null)
                {
                    g.CompositingQuality = CompositingQuality.HighQuality;
                    g.DrawIcon(glyph, 325, 10);
                }
            }
        }
    }
}
